package com.sydata.cdrdata.service.impl;


import com.sydata.cdrdata.domain.LinksFieldCdrRecord;
import com.sydata.cdrdata.mapper.LinksFieldCdrMapper;
import com.sydata.cdrdata.service.ILkCdrService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;


/**
 * 话单 Service业务层处理
 *
 * @author haungzj
 * @date 2023-07-25
 */
@Service
public class LkCdrServiceImpl implements ILkCdrService {

    @Autowired
    private LinksFieldCdrMapper linksFieldCdrMapper;


    /**
     * 批量入库
     *
     * @param cdrList
     */
    @Transactional
    public void insertBatch(List<LinksFieldCdrRecord> cdrList) {
        linksFieldCdrMapper.insertBatch(cdrList);
    }


    /**
     * 入库
     * @param record
     */
    @Transactional
    public void insert(LinksFieldCdrRecord record){
        linksFieldCdrMapper.insert(record);
    }

    /**
     * 通过imsi 获取imsi 下的 渠道、代理商 、iccid 等等信息
     * @param orderNo
     * @return
     */
    public List<Map<String, Object>> getImsiInfo(@Param("imsi") String imsi,@Param("billDate") String billDate){
        return linksFieldCdrMapper.getImsiInfo(imsi,billDate);
    }

}
